﻿using Hrm.Core;

namespace Hrm.EntityFramework.MigrationsHrm
{
    using System;
    using System.Collections.Generic;
    using System.Data.Entity;
    using System.Data.Entity.Migrations;
    using System.Linq;
    /// <summary>
    /// Enable-Migrations -ContextTypeName Hrm.EntityFramework.HrmDbContext -MigrationsDirectory:MigrationsHrm
    /// Add-Migration -configuration Hrm.EntityFramework.MigrationsHrm.Configuration Initial
    /// Update-Database -configuration Hrm.EntityFramework.MigrationsHrm.Configuration -Verbose
    /// </summary>
    internal sealed class Configuration : DbMigrationsConfiguration<Hrm.EntityFramework.HrmDbContext>
    {
        public Configuration()
        {
            AutomaticMigrationsEnabled = false;
            MigrationsDirectory = @"MigrationsHrm";
        }

        protected override void Seed(Hrm.EntityFramework.HrmDbContext context)
        {
            //var department = new Department
            //{
            //    Name = "js",
            //    CreateDatetime=DateTime.Now,
            //    UpdateDatetime=DateTime.Now,
            //};
            //context.Departments.AddOrUpdate(p => p.Name
            //    , department);
            //var school = new School()
            //{
            //    Name = "贵州大学",
            //    CreateDatetime = DateTime.Now,
            //    UpdateDatetime = DateTime.Now,
            //};
            //context.Schools.AddOrUpdate(p=>p.Name,school);

            //var classmate1 = new ClassMate()
            //{
            //    Name="张晓亮",
            //    Phone="11111",
            //    Address="贵州",
            //    QQ="2222",
            //    Company="小站教育",
            //    WeChat="3333",
            //    Description= "牛叉",
            //    CreateDatetime = DateTime.Now,
            //    UpdateDatetime = DateTime.Now,
            //    Schools = new List<School>() { school }
            //};
            //var classmate2 = new ClassMate()
            //{
            //    Name = "田位",
            //    Phone = "11111",
            //    Address = "贵州",
            //    QQ = "2222",
            //    Company = "电视台",
            //    WeChat = "3333",
            //    Description = "牛叉",
            //    CreateDatetime = DateTime.Now,
            //    UpdateDatetime = DateTime.Now,
            //    Schools = new List<School>() { school }
            //};
            //context.ClassMates.AddOrUpdate(p=>p.Name,classmate1,classmate2);

            
        }
    }
}
